<div class="row" ng-controller="bs_userHome">

    <div class="row">
        <div class=col-md-6>
            <ol class="breadcrumb">
                <li><a ui-sref="book.recommend()">图书主页</a></li>
                <li class="active"><strong>用户-</strong>{{owner.attributes.nickName}}</li>
            </ol>
        </div>
        <div class="col-md-6">
            <div class="btn-toolbar pull-right">
                <div class="btn-group">
                    <a class="btn btn-default" ng-click="scrollToHash('userUsedBook')">Ta的旧书</a>
                    <a class="btn btn-default" ng-click="scrollToHash('userNeedBook')">Ta的求书</a>
                    <a class="btn btn-default" ng-click="scrollToHash('userCircleBook')">Ta的书漂流</a>
                </div>
                <div class="btn-group" ng-if="isMe()">
                    <a class="btn btn-default btn-info"
                       ui-sref="person.upload-one-used-book({role:'sell'})">上传旧书
                    </a>
                    <a class="btn btn-default btn-primary"
                       ui-sref="person.upload-one-used-book({role:'need'})">发布求书
                    </a>
                    <a class="btn btn-default btn-primary"
                       ui-sref="person.upload-one-used-book({role:'circle'})">上传书漂流
                    </a>
                </div>
            </div>
        </div>
    </div>

    <div class="row text-center">

        <div class="col-md-12">
            <bs-one-user user="owner"
                         margin="5"
                         popover-placement="right"
                         avatar-size="80"
                         image-size="132"></bs-one-user>
        </div>

        <div class="col-md-12">
            <h3 ng-bind="owner.attributes.nickName"></h3>
            <h4>
                <span>
                    <span class="glyphicon glyphicon-user" style="color: #5eb1ed"
                          ng-if="owner.attributes.sex==1"></span>
                    <span class="glyphicon glyphicon-user" style="color: #ff6d9e"
                          ng-if="owner.attributes.sex==2"></span>
                </span>
                <span ng-bind="owner.attributes.major"></span>
                <span ng-bind="owner.attributes.school"></span>
                <span>{{owner.attributes.startSchoolYear}}级</span>
                <a target="_blank"
                   ng-if="owner.attributes.location"
                   ng-href="{{ownerMapUrl()}}">
                    主人位置
                </a>
            </h4>
        </div>

        <div class="col-md-12" ng-if="!isMe()">
            <a class="btn btn-info btn-sm"
               ui-sref="person.send-msg-to-user({receiverObjectId:owner.id,role:'buy',inboxType:'private'})">发私信</a>
            <button class="btn btn-primary btn-sm" ng-if="!isMyFollowee && !isMe()"
                    ng-click="User$.followUser(owner.id)">关注Ta
            </button>
            <button class="btn btn-warning btn-sm" ng-if="isMyFollowee" ng-click="User$.unfollowUser(owner.id)">取消关注
            </button>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <h4 id="userUsedBook">Ta的旧书</h4>
            <hr>
            <a class="text-warning" ng-if="usedBooks.length==0" ui-sref="book.used-book-list({cmd:'nearUsed'})">Ta还没有要卖的旧书，去看看其他同学的旧书</a>
        </div>

        <div class="col-md-3" ng-repeat="usedBook in usedBooks">
            <bs-one-used-book used-book="usedBook" popover-placement="right"></bs-one-used-book>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <h4 id="userNeedBook">Ta的求书</h4>
            <hr>
            <a class="text-warning" ng-if="needBooks.length==0" ui-sref="book.used-book-list({cmd:'nearNeed'})">Ta还没有发布的求书，去看看其他同学的求书</a>
        </div>

        <div class="col-md-3" ng-repeat="needBook in needBooks">
            <bs-one-used-book used-book="needBook" popover-placement="right"></bs-one-used-book>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <h4 id="userCircleBook">Ta的书漂流</h4>
            <hr>
            <a class="text-warning" ng-if="circleBooks.length==0" ui-sref="book.used-book-list({cmd:'nearCircle'})">Ta还没有上传的书漂流，去看看其他同学的书漂流</a>
        </div>

        <div class="col-md-3" ng-repeat="circleBook in circleBooks">
            <bs-one-used-book used-book="circleBook" popover-placement="right"></bs-one-used-book>
        </div>
    </div>

</div>